The RPN (Reverse Polish Notation) function handles mathematical operations in the Record Dictionary. The RPN function is used as a parameter of a variable in the Record Dictionary. Use Reverse Polish Notation to express your equation. Any variables that are referenced must be previously defined in the Record Dictionary.
Use the format:
RPN(valid RPN equation)
A valid RPN equation can include: variables, numeric constants, arithmetic operators (+,-,*,/,%), and several functions (MOD, ABS, DUP, SWAP, POW, SQRT, CEIL, FLOOR). When using a function, place a ‘#’ sign before the function name (example: #MOD). This distinguishes a function name from a variable name.
RPN can also be used with date format variables. This can be useful when adding to a date or calculating an age. Here are some examples:
RPN or Reverse Polish Notation is an arithmetic method that performs calculations from left to right. A stack is created to hold numeric values until an operation is performed. For instance, a simple equation such as “ 1 + 2 ” would be represented as “ 1 2 + ”. During computation, the stack would first hold “1”, then it would be given “2”. When the “+” is reached, the “1” and “2” are taken off the stack and added together. A slightly more complicated equation such as “ (1 + 2 ) * 5 “ would be represented as “ 1 2 + 5 * ”.
Note | No parentheses are needed in RPN logic. |
These are the available functions in RPN. When using them, remember to place a “#” sign in front of the function name. This distinguishes a function name from a variable name.
Function |
Description |
References the most recent value and returns the absolute value of that number. |
|
Returns the next largest integer value of a number (round up). |
|
Creates a duplicate of the top value in the stack. |
|
Returns the next smallest integer value of a number (round down). |
|
Compares the top two values on the stack and returns the larger. |
|
Compares the top two values on the stack and returns the smaller. |
|
Performs a division with the top two values on the stack and returns the remainder. |
|
Removes the top two values in the stack. Calculates the first to the power of the second. |
|
Returns the square root of the number. |
|
Removes the top two values in the stack and replaces them in reverse order. |
© Copyright 2014, Oracle and/or its affiliates. All rights reserved. Legal notices.